package ru.sgu.diploma.practic.domain.model;

import ru.sgu.diploma.practic.errors.NoRuleForInputException;

import java.util.HashMap;
import java.util.Map;

/**
 * User: datmakin
 * Date: 13.03.11
 * Email: atmakin.dv@gmail.com
 */
public class State {
    private String stateName;

    private Map<String, String> outputs = new HashMap<String, String>();
    private Map<String, String> nextStates = new HashMap<String, String>();

    public State() {
    }

    public State(String stateName) {
        this.stateName = stateName;
    }

    public String getOutputForInput(String input) throws NoRuleForInputException {
        if (!outputs.containsKey(input))
            throw new NoRuleForInputException("input");
        return outputs.get(input);
    }

    public String getNextStateNameForInput(String input) throws NoRuleForInputException {
        if (!nextStates.containsKey(input))
            throw new NoRuleForInputException("input");
        return nextStates.get(input);
    }

    public String getStateName() {
        return stateName;
    }

    public void setStateName(String stateName) {
        this.stateName = stateName;
    }

    public Map<String, String> getOutputs() {
        return outputs;
    }

    public void setOutputs(Map<String, String> outputs) {
        this.outputs = outputs;
    }

    public Map<String, String> getNextStates() {
        return nextStates;
    }

    public void setNextStates(Map<String, String> nextStates) {
        this.nextStates = nextStates;
    }
}
